[Unit]
Description=Redis persistent key-value database 
After=network.target 
After=network-online.target 
Wants=network-online.target
 
[Service]
LimitNOFILE=65536
ExecStart=/usr/local/bin/redis-server /etc/redis/conf/redis.conf --supervised systemd 
{% if hostvars[ansible_default_ipv4.address].redis_password is not defined %}
ExecStop=/usr/local/bin/redis-cli shutdown 
{% else %}  
ExecStop=/usr/local/bin/redis-cli {{ hostvars[ansible_default_ipv4.address].redis_password }} shutdown 
{% endif %}
User=root
Group=root
RuntimeDirectory=redis 
RuntimeDirectoryMode=0755
 
[Install] 
WantedBy=multi-user.target
